cmake_minimum_required(VERSION 3.22)
project(iperf3 VERSION 0.0.0)

include(cmake/my_utils.cmake)

#/* src/iperf_config.h.in.  Generated from configure.ac by autoheader.  */
my_check_function_exists_and_define_macro(clock_gettime HAVE_CLOCK_GETTIME)
my_check_function_exists_and_define_macro(clock_nanosleep HAVE_CLOCK_NANOSLEEP)
#my_check_function_exists_and_define_macro(cpuset_setaffinity HAVE_CPUSET_SETAFFINITY)
#/* Have CPU affinity support. */
#undef HAVE_CPU_AFFINITY
my_check_function_exists_and_define_macro(daemon HAVE_DAEMON)

my_check_header_exists_and_define_macro("dlfcn.h")
#/* Have IP_MTU_DISCOVER/IP_DONTFRAG/IP_DONTFRAGMENT sockopt. */
#undef HAVE_DONT_FRAGMENT

my_check_header_exists_and_define_macro("endian.h")
#/* Have IPv6 flowlabel support. */
#undef HAVE_FLOWLABEL
my_check_function_exists_and_define_macro(getline HAVE_GETLINE)
my_check_header_exists_and_define_macro("inttypes.h")

#/* Have MPTCP protocol. */
#undef HAVE_IPPROTO_MPTCP

#/* Have IP_DONTFRAG sockopt. */
#undef HAVE_IP_DONTFRAG

#/* Have IP_DONTFRAGMENT sockopt. */
#undef HAVE_IP_DONTFRAGMENT

#/* Have IP_MTU_DISCOVER sockopt. */
#undef HAVE_IP_MTU_DISCOVER

my_check_header_exists_and_define_macro("linux/tcp.h")

#/* Have MSG_TRUNC recv option. */
#undef HAVE_MSG_TRUNC

my_check_function_exists_and_define_macro(nanosleep HAVE_NANOSLEEP)
#my_check_header_exists_and_define_macro("netinet/sctp.h")
my_check_header_exists_and_define_macro("poll.h")

#/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
add_definitions(-DHAVE_PTHREAD)
#/* Have PTHREAD_PRIO_INHERIT. */
#undef HAVE_PTHREAD_PRIO_INHERIT

my_check_function_exists_and_define_macro(sched_setaffinity HAVE_SCHED_SETAFFINITY)

#/* Have SCTP support. */
#undef HAVE_SCTP_H

my_check_function_exists_and_define_macro(sendfile HAVE_SENDFILE)

#my_check_function_exists_and_define_macro(SetProcessAffinityMask HAVE_SETPROCESSAFFINITYMASK)

#/* Have SO_BINDTODEVICE sockopt. */
#undef HAVE_SO_BINDTODEVICE

#/* Have SO_MAX_PACING_RATE sockopt. */
#undef HAVE_SO_MAX_PACING_RATE

#/* OpenSSL Is Available */
#undef HAVE_SSL

my_check_header_exists_and_define_macro("stdatomic.h")

my_check_header_exists_and_define_macro("stdint.h")
my_check_header_exists_and_define_macro("stdio.h")
my_check_header_exists_and_define_macro("stdlib.h")
my_check_header_exists_and_define_macro("strings.h")
my_check_header_exists_and_define_macro("string.h")
#/* Define to 1 if the system has the type 'struct sctp_assoc_value'. */
#undef HAVE_STRUCT_SCTP_ASSOC_VALUE

my_check_header_exists_and_define_macro("sys/endian.h")
my_check_header_exists_and_define_macro("sys/socket.h")
my_check_header_exists_and_define_macro("sys/stat.h")
my_check_header_exists_and_define_macro("sys/types.h")

#/* Have TCP_CONGESTION sockopt. */
#undef HAVE_TCP_CONGESTION

#/* Have tcpi_snd_wnd field in tcp_info. */
#undef HAVE_TCP_INFO_SND_WND

#/* Have TCP_KEEPIDLE sockopt. */
#undef HAVE_TCP_KEEPALIVE

#/* Have TCP_USER_TIMEOUT sockopt. */
#undef HAVE_TCP_USER_TIMEOUT

my_check_header_exists_and_define_macro("unistd.h")

#/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR

#/* Name of package */
#undef PACKAGE

#/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

#/* Define to the full name of this package. */
#undef PACKAGE_NAME

#/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
add_definitions(-DPACKAGE_STRING="0.0.1")

#/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

#/* Define to the home page for this package. */
#undef PACKAGE_URL

#/* Define to the version of this package. */
#undef PACKAGE_VERSION

#/* Define to necessary symbol if this constant uses a non-standard name on
#   your system. */
#undef PTHREAD_CREATE_JOINABLE

#/* Define to 1 if all of the C89 standard headers exist (not just the ones
#   required in a freestanding environment). This macro is provided for
#   backward compatibility; new code need not use it. */
#undef STDC_HEADERS

#/* Version number of package */
#undef VERSION

#/* Define to empty if 'const' does not conform to ANSI C. */
#undef const

add_subdirectory(src)
#add_subdirectory(examples)
